package com.ex.ui.questionpanel;

import static org.junit.Assert.*;

import java.awt.Color;

import javax.swing.JFrame;

import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JButtonFixture;
import org.fest.swing.fixture.JPanelFixture;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class HeartAreaPanelTest {

	FrameFixture testFrame;
	JFrame objFrame;
	@Before
	public void setUp() throws Exception {
		HeartAreaPanel p = new HeartAreaPanel(null);
		p.setVisible(true);
		p.setName("Heart");
		objFrame = new JFrame(); 
		objFrame.setSize(p.getWidth(), p.getHeight());
		objFrame.setContentPane(p);
		objFrame.setLocationRelativeTo(null); 
	 	objFrame.setVisible(true); 
		testFrame = new FrameFixture(objFrame);  
		
	}

	@After
	public void tearDown() throws Exception {
		objFrame.dispose();
		testFrame.cleanUp();
	}

	@Test
	public void test() {
		JPanelFixture panel = testFrame.panel("Heart");
		 	 
		 panel.textBox("mEdit1").deleteText();
		 panel.textBox("mEdit2").deleteText();
		 
		 panel.textBox("mEdit1").enterText("3");
		 panel.textBox("mEdit2").enterText("4");
		 
		 JButtonFixture jbf = panel.button("mCommitBtn");
		 jbf.click();
//		 panel.label("mRightAnswerTa").requireVisible();
//		 assertEquals( Color.GREEN, panel.label("mRightAnswerTa").foreground().target());
	}

}
